package com.woniuxy.seckill.service.Impl;

import com.hc.entity.Discount;
import com.hc.entity.Seckill;
import com.woniuxy.seckill.mapper.DiscountMapper;
import com.woniuxy.seckill.mapper.SeckillMapper;
import com.woniuxy.seckill.service.SeckillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @BelongsProject: hc
 * @BelongsPackage: com.woniuxy.seckill.service.Impl
 * @Author: WY
 * @CreateTime: 2022-10-25  15:31
 * @Descriprion: 秒杀模块Impl
 * @Version: 1.0
 **/
@Service
public class SeckillServiceImpl implements SeckillService {

    @Autowired
    SeckillMapper seckillMapper;

    @Autowired
    DiscountMapper discountMapper;

    //查询商家发布的秒杀信息
    @Override
    public Seckill findByShopId(Integer sid) {
        Seckill seckill = seckillMapper.findByShopId(sid);
        return seckill;
    }

    @Override
    public void updateStatusById(Integer id) {
        seckillMapper.updatestatus(id);
    }

    @Override
    public void addDiscount(Discount discount) {
        discountMapper.addDiscount(discount);
    }
}
